<?php
//error_reporting(0);
require_once 'classes/Applicatie.php';
$app = new Applicatie();

session_start();

 if (empty($_SESSION['userName'])){  
     $ingelogd = 0;
 }
 
 else {
     $ingelogd = 1;
 }
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />

        <title>RoboTik Informatiesysteem</title>
    </head>


    <body>
        <div id="page">

            <div id="titlebar">
                <h1>Robotik - Informatiesysteem</h1>
            </div>
            <div id="bar">
                <ul>
                    <?php 
                    if ($ingelogd == 0){ 
                            echo '<li><a href="index.php?app=catalogus">Catalogus</a></li>';
                            echo '<li><a href="index.php?app=inloggen">Inloggen</a></li>';
                            print '<li><a href="index.php?app=registreren">Registreren</a></li>';
                        } 
                        
                        else { 
                            print'<li><a href="index.php?app=ingelogd">'.$_SESSION['userName']. '</a></li>';
                            print '<li><a href="index.php?app=catalogus">Catalogus</a></li>';
                             print '<li><a href="index.php?app=uitloggen">Uitloggen</a></li>';
                       
                        }
                        
                        ?>

                </ul>
            </div>
            <div id="main">
                <?php
                
                if(isset($_GET["app"])){ 
                
                switch ($_GET["app"]) {
                    
                    case 'catalogus':
                        $app->Robottoevoegen();
                        break;
                    
                    case 'inloggen':
                        $app->Login();
                        break;
                    
                    case 'registreren':
                        $app->Registreren();
                        break;
                    case 'ingelogd':
                        $app->Ingelogd();
                        break;
                    
                    case 'uitloggen':
                         session_destroy();
                        break;
                }
                
                }
                
                else{
                    $app->Homepage();
                    }
                
                
                ?>
            </div>

            <div id="footer">Copyright 2012: RoboTik</div>
        </div>
    </body>
</html>
